<?php session_start();
 include 'functions.php';
 $member_id = $_SESSION['member_id'];
 if(isset($_POST['confID'])) {
 $confID = $_POST['confID'];
  $query2 = "SELECT M.first_name, M.last_name, M.member_id
           FROM member M
           INNER JOIN member_privileges MP
           ON M.member_id = MP.member_id
           INNER JOIN privileges Pr
           ON MP.privileges_id = Pr.privileges_id
           WHERE MP.conference_id = {$confID}
           AND Pr.role = 'reviewer'
           AND M.member_id <> {$member_id}";
            $reviewers = mysql_query($query2) or die(mysql_error());
        if ($reviewers) {
            if(mysql_num_rows($reviewers) == 0) {
        echo ' <p align="center">No reviewers found in this conference</p>';
    } else {
            print "<table id='Reviewers'>\n";
            print "<tr>\n";
            ?>
                <td width="15%" style="background-color: #003366; color: white;">
                    <input type="checkbox" name="Rselectall" class="Rselectall" id="Rselectall"/>
                    <label class="cursor_pointer" id="Rselectall" for="Rselectall">Check all</label></td>
                <td width="85%" style="background-color: #003366; color: white; text-align: center;"> Reviewer name </td><?php
        print "</tr>\n";
        //create table
        $i = 0;
        while ($row = mysql_fetch_array($reviewers)) {
            $i++;
            $f_name = formatText_safe($row['first_name']);
            $l_name = formatText_safe($row['last_name']);
            print "<tr>\n";
            print "<td><input type=\"checkbox\" name=\"reviewers[]\" value=\"$row[member_id]\"></td>\n";
            echo "<input type='hidden' value=\"{$row['member_id']}\" />\n";
            echo "<td>{$f_name} {$l_name}</td>\n";

            echo "</tr>\n";
        }//end while
        print "</table>\n";
    }
        }
 } else {
     echo "no data";
 }
?>
